#pragma once
#pragma once
#if _MSC_VER >=1600
#pragma execution_character_set("utf-8")
#endif

#include <QDialog>
#include "ui_CDlgSetupRefMatrix.h"

//namespace Ui { class CDlgSetupRefMatrix; };

#include "RefSpec.h"
//#include "nti_matrix.h"

#define szCombBoxFirstText  tr("To select...")

class CDlgSetupRefMatrix : public QDialog
{
	Q_OBJECT

public:
	CDlgSetupRefMatrix(QWidget *parent = Q_NULLPTR);
	~CDlgSetupRefMatrix();

	// in
	int m_nCtrl;
	//int m_nFFT;
	QList<REF_PSD> m_listRefPSD;
	QList<REF_COH> m_listRefCoh;
	QList<REF_PHI> m_listRefPhi;

	// out
	//MAT::zArray3d m_zArray3dMatRef;
	QMap<QPair<int, int>, int> m_mapMatPSDIndex;
	QMap<QPair<int, int>, int> m_mapMatCohIndex;
	QMap<QPair<int, int>, int> m_mapMatPhiIndex;
private:
	Ui::CDlgSetupRefMatrix *ui;
	//std::pa
	QStringList m_listRefPSDName;
	QStringList m_listRefCohName;
	QStringList m_listRefPhiName;
private:
	void InitTableWidget(QTableWidget* pTable);
	void UpdateTableWidget();
	bool ValidateRefTable();// std::vector<int>* indexPSD, std::vector<int>* indexCoh, std::vector<int>* indexPhi);
	void RemoveEditWidget();

public:
	void on_btnLoadFrom_clicked();
	void on_tableMatDiag_cellClicked(int row, int column);
	void on_tableMatDiag_currentCellChanged(int currentRow, int currentColumn, int previousRow, int previousCol);
	void on_tableMatNondiag_cellClicked(int row, int col);
	void on_tableMatNondiag_currentCellChanged(int currentRow, int currentCol, int previousRow, int previousCol);

	void on_btnApply_clicked();
	void on_btnOK_clicked();

protected:
	void showEvent(QShowEvent *evt);
};
